package com.martin.dms.factories.hib;

import com.martin.dms.factories.ItemFactory;
import com.martin.dms.model.Category;
import com.martin.dms.model.Item;
import com.martin.dms.model.hib.ItemHib;

/**
 * Hibernate implementation of the Item factory.
 * 
 * @author mtsvetkov
 */
public class ItemFactoryHib implements ItemFactory {

    /**
     * {@inheritDoc}
     */
    public Item create(String name, int price) {
        ItemHib item = new ItemHib();
        item.setName(name);
        item.setPrice(price);
        return item;
    }

    /**
     * {@inheritDoc}
     */
    public Item create(String name, int price, String description, byte[] image, Category category) {
        ItemHib item = new ItemHib();
        item.setName(name);
        item.setPrice(price);
        item.setDescription(description);
        item.setImage(image);
        item.setCategory(category);
        return item;
    }

}
